package com.x.netty.netty.file;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
 * @Author _G5niusX
 * @Date 2018/5/27 11:19
 */
public class FileClientHandler extends ChannelInboundHandlerAdapter {
    private final ByteBuf byteBuf;

    public FileClientHandler(ByteBuf byteBuf) {
        this.byteBuf = byteBuf;
    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        super.channelRead(ctx, msg);
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        ctx.writeAndFlush(byteBuf);
    }
}
